﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autofac;
//using Autofac.Extras.DynamicProxy2;
using Castle.DynamicProxy;
using AOP.Interceptor;

namespace AOP
{
    public class Container
    {
        private static IContainer _container;

        public static void Init(IContainer iContainer)
        {
            _container = iContainer;
        }

        public static T ResolveClass<T>() where T : class
        {
            return _container.Resolve<T>();
        }

        public static T ResolveClass<T>(params string[] param) where T : class
        {
            return _container.Resolve<T>(param.Select(TypedParameter.From).ToArray());
        }

        public static T ResolveClass<T>(params TypedParameter[] param) where T : class
        {
            return _container.Resolve<T>(param);
        }
    }
}
